package cn.usian.pricingstrategy.driver.controller;


import cn.usian.basicInformation.log.commons.Constants;
import cn.usian.basicInformation.log.commons.Log;
import cn.usian.pojo.Result;
import cn.usian.pojo.pricingstrategy.driver.OperateDriverCharges;
import cn.usian.pricingstrategy.driver.service.IDriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/driver")
public class DriverController {
    @Autowired
    private IDriverService driverService;

    @Log(operationModule = "定价策略", operationType = Constants.UPDATE)
    @PostMapping("/save")
    public Result save(@RequestBody OperateDriverCharges operateDriverCharges){
        return driverService.save(operateDriverCharges);
    }

    @GetMapping("/findById/{id}")
    public Result findById(@PathVariable long id){
        return Result.ok(driverService.findById(id));
    }

    @GetMapping("/list")
    public Result list(){
        return Result.ok(driverService.list());
    }

}
